var ClubApplyItem = Item.extend({
    _ccsFileName: res.ClubApplyItem_json,
    _msgData: null,
    _clubId: 0,

    initItem: function (clubId, data) {
        this._msgData = data;
        this._clubId = clubId;
    },

    onEnter: function () {
        Item.prototype.onEnter.call(this);
        this._addClickListeners();
    },

    _initClickListeners: function () {
        this._clickListeners = {
            'btn_jujue': '_clickJuJue',
            'btn_tongyi': '_clickTongYi',
        }
    },

    /**
     * 拒绝申请
     * @private
     */
    _clickJuJue: function () {
        network.send(2103, {
            cmd: this._sendMsgCmd, club_id: this._clubId, obj_id: this._sendObjId,
            msg_id: this._msgData['_id'], name: this._msgData['name'], head: this._msgData['head'], value: 'reject'
        });
    },

    /**
     * 同意申请
     * @private
     */
    _clickTongYi: function () {
        network.send(2103, {
            cmd: this._sendMsgCmd, club_id: this._clubId, obj_id: this._sendObjId,
            msg_id: this._msgData['_id'], name: this._msgData['name'], head: this._msgData['head'], value: 'accept'
        });
    },


    refreshData: function (clubId, data) {
        this._msgData = data;
        this._clubId = clubId;

        this._sendMsgCmd = this._msgData.type == 'comboClub' ? 'agreeComboClub' : 'agreeClub';
        this._sendObjId = this._msgData.type == 'comboClub' ? this._msgData.detail.old_club_id : this._msgData['uid'];


        this._nodeList['lb_time'].setString(data['create_time']);
        this._nodeList['playerName'].setString(ellipsisStr(data['name'], ClubDataManager.NirckNameSize));
        this._nodeList['id'].setString('ID:' + data['uid']);

        loadImageToSprite(decodeURIComponent(data['head']), this._nodeList['head'], true);
        if (data.type == 'comboClub') { //合群消息
            this._nodeList['tip2'].setString('申请合群时间');
            this._nodeList['tip2'].setColor(cc.color(255, 0, 0));
        }
    },
});